package com.aisino.service.jobs;

import cn.hutool.core.thread.ThreadUtil;

import java.util.concurrent.ThreadPoolExecutor;

/**
 * @author guochuantao
 * @version 1.0
 * @description
 * @since 2024/8/14 上午11:16
 */
public class ThreadMail {
    public static void main(String[] args) {
        ThreadPoolExecutor threadPoolExecutor = ThreadUtil.newExecutor(1, 2);
        threadPoolExecutor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("任务1");
                ThreadUtil.sleep(2000);
            }
        });
        threadPoolExecutor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println(2);
                ThreadUtil.sleep(1000);
            }
        });
        threadPoolExecutor.submit(new Runnable() {
            @Override
            public void run() {
                System.out.println("error");
            }
        });
        threadPoolExecutor.shutdown();
    }

}
